//
//  MasonryUseViewController.m
//  myselfTest
//
//  Created by Lucifer on 15/9/23.
//  Copyright © 2015年 xuxzhou. All rights reserved.
//

#import "MasonryUseViewController.h"
#import "Masonry.h"

@interface MasonryUseViewController ()

@end

@implementation MasonryUseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    
    
       [self myselfTeseFour];
    
    
}
-(void)someOneTest{
    UIView *superview = self.view;
    
    float left = 25;
    float padding = 15;
    float height = 150;
    
    UIView *redView = [[UIView alloc] init];
    redView.backgroundColor = [UIColor redColor];
    [self.view addSubview:redView];
    UIView *greenView = [[UIView alloc] init];
    greenView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:greenView];
    UIView *orangeView = [[UIView alloc] init];
    orangeView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:orangeView];
    
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superview.mas_centerY);
        make.left.equalTo(superview.mas_left).offset(left);
        make.right.equalTo(greenView.mas_left).offset(-padding);
        
        make.height.mas_equalTo(height);
        make.width.equalTo(greenView);
    }];
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(redView.mas_centerY);
        make.bottom.mas_equalTo(redView.mas_bottom);
        make.left.equalTo(redView.mas_right).offset(padding);
        make.right.equalTo(orangeView.mas_left).offset(-padding);
        
        make.width.equalTo(redView);
    }];
    
    [orangeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(greenView.mas_centerY);
        make.bottom.mas_equalTo(greenView.mas_bottom);
        make.left.equalTo(greenView.mas_right).offset(padding);
        make.right.equalTo(superview.mas_right).offset(-left);
        make.width.equalTo(greenView);
    }];
    
}
-(void)myselfTest{

    UIView *superview = self.view;
    
    float left = 25;
    float padding = 15;
    float height = 300;
    
    UIView *redView = [[UIView alloc] init];
    redView.backgroundColor = [UIColor redColor];
    [self.view addSubview:redView];
    UIView *greenView = [[UIView alloc] init];
    greenView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:greenView];
    UIView *orangeView = [[UIView alloc] init];
    orangeView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:orangeView];
    
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superview.mas_centerY);
        make.left.equalTo(superview.mas_left).offset(left);
        make.right.equalTo(superview.mas_right).offset(-left);
        make.height.mas_equalTo(height);
    }];
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(redView.mas_top).offset(padding);
        make.bottom.equalTo(redView.mas_bottom).offset(-padding);
        make.left.equalTo(redView.mas_left).offset(left);
        make.right.equalTo(redView.mas_right).offset(-left);
    }];

    [orangeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(greenView.mas_top).offset(padding);
        make.bottom.equalTo(greenView.mas_bottom).offset(-padding);
        make.left.equalTo(greenView.mas_left).offset(left);
        make.right.equalTo(greenView.mas_right).offset(-left);
    }];

}
-(void)myselfTestTwo{


    UIView *superview = self.view;
    
    float left = 25;
    float padding = 15;
    float height = 300;
    
    UIView *redView = [[UIView alloc] init];
    redView.backgroundColor = [UIColor redColor];
    [self.view addSubview:redView];
    UIView *greenView = [[UIView alloc] init];
    greenView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:greenView];
    UIView *orangeView = [[UIView alloc] init];
    orangeView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:orangeView];
    
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superview.mas_centerY);
        make.left.equalTo(superview.mas_left).with.offset(left);
        make.right.equalTo(greenView.mas_left).with.offset(-padding);
        make.height.mas_equalTo(height);
        make.width.mas_equalTo(greenView);
    }];
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(redView.mas_top).with.offset(padding);
        make.bottom.equalTo(redView.mas_bottom).with.offset(-padding);
        make.left.equalTo(redView.mas_right).with.offset(left);
        make.right.equalTo(orangeView.mas_left).with.offset(-left);
        make.width.mas_equalTo(greenView);

    }];
    
    [orangeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(greenView.mas_top).with.offset(padding);
        make.bottom.equalTo(greenView.mas_bottom).with.offset(-padding);
        make.left.equalTo(greenView.mas_right).with.offset(left);
        make.right.equalTo(superview.mas_right).with.offset(-left);
        make.width.mas_equalTo(greenView);

    }];
}
-(void)myselfTeseFour{
    UIView *superview = self.view;
    
    float left = 25;
    float padding = 15;
    float height = 300;
    
    UIView *redView = [[UIView alloc] init];
    redView.backgroundColor = [UIColor redColor];
    [self.view addSubview:redView];
    UIView *greenView = [[UIView alloc] init];
    greenView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:greenView];
    UIView *orangeView = [[UIView alloc] init];
    orangeView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:orangeView];
    
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superview.mas_centerY);
        
        make.left.equalTo(superview.mas_left).with.offset(left);
        make.right.equalTo(superview.mas_right).with.offset(-left);
        make.height.mas_equalTo(height);
        
    }];
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(superview.mas_centerX);
        make.height.mas_equalTo(redView.mas_height).with.offset(-padding);
        
        make.bottom.equalTo(redView.mas_bottom);
        make.left.equalTo(redView.mas_left).with.offset(left);
        make.right.equalTo(redView.mas_right).with.offset(-left);
        
    }];
    
    [orangeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(superview.mas_centerX);
        
        make.height.mas_equalTo(greenView.mas_height).with.offset(-padding);
        make.bottom.equalTo(greenView.mas_bottom);
        make.left.equalTo(greenView.mas_left).with.offset(left);
        make.right.equalTo(greenView.mas_right).with.offset(-left);
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
